package com.tul.exercise.base.string.regex;


import org.junit.jupiter.api.Test;

import java.util.Arrays;

import static  com.tul.exercise.base.utils.Print.*;

/**
 * @Description 《java编程思想》第13章 示例10：
 * <p>
 * split的正则匹配功能
 **/
public class Splitting {

    public static String str = "Then, when you have found the shrubbery, you must " +
            "cut down the mightiest tree in the forest..." +
            "with ... a herring!";

    public static void split(String regex) {
        print(Arrays.toString(str.split(regex)));
    }

    @Test
    public void test() {
        split(" ");
        split("\\W+");
        split("n\\W+");

    }
}
